// 表单校验规则由 schema2code 生成，不建议直接修改校验规则，而建议通过 schema2code 生成, 详情: https://uniapp.dcloud.net.cn/uniCloud/schema


const locaLang = uni.getLocale()
const message = {
	"name_required": {
		"zh-Hans": "收件人必填",
		"en": "Recipient is required",
		"ru": "Необходимо указать получателя"
	},
	"mobile_required": {
		"zh-Hans": "手机号必填",
		"en": "Mobile number is required",
		"ru": "Необходимо указать мобильный номер"
	},
	"area_code_required": {
		"zh-Hans": "省市区必填",
		"en": "Province/City/District are required",
		"ru": "Необходимо указать Область / Город / Район"
	},
	"address_required": {
		"zh-Hans": "详细住址必填",
		"en": "Detailed address is required",
		"ru": "Необходимо указать подробный адрес"
	}
}
const validator = {
	"user_id": {
		"rules": [{
			"format": "string"
		}]
	},
	"name": {
		"rules": [{
				"required": true,
				"errorMessage": message.name_required[locaLang]
			},
			{
				"format": "string"
			}
		],
		"label": "收货人"
	},
	"alias": {
		"rules": [{
			"format": "string"
		}],
		"label": "地址别名"
	},
	"mobile": {
		"rules": [{
				"required": true,
				"errorMessage": message.mobile_required[locaLang]
			},
			{
				"format": "string"
			},
			{
				"pattern": "^\\+?[0-9-]{3,20}$"
			}
		],
		"label": "手机号"
	},
	"mobile_area_code": {
		"rules": [{
			"format": "string"
		}],
		"label": "国际区号"
	},
	"province_code": {
		"rules": [{
			"format": "string"
		}],
		"label": "省"
	},
	"city_code": {
		"rules": [{
			"format": "string"
		}],
		"label": "市"
	},
	"area_code": {
		"rules": [{
				"required": true,
				"errorMessage": message.area_code_required[locaLang]
			},
			{
				"format": "string"
			}
		],
		"label": "省市区"
	},
	"address": {
		"rules": [{
				"required": true,
				"errorMessage": message.address_required[locaLang]
			},
			{
				"format": "string"
			}
		],
		"label": "详细住址"
	},
	"formatted_address": {
		"rules": [{
			"format": "string"
		}]
	},
	"zip_code": {
		"rules": [{
			"format": "string"
		}],
		"label": "邮编"
	},
	"email": {
		"rules": [{
				"format": "string"
			},
			{
				"format": "email"
			}
		],
		"label": "邮箱"
	},
	"is_default": {
		"rules": [{
			"format": "bool"
		}],
		"defaultValue": false,
		"label": "默认地址"
	}
}

const enumConverter = {}

export {
	validator,
	enumConverter
}